<?php
require_once '../../Lib/main.php';
try {
	$categoryDAO = new Dao_CategoryDAO();
	$listCategory = $categoryDAO->getCategory();
	
	foreach ($listCategory as $key => $category) {
		$inArr = array();
		$inArr['id'] = $category->getId();
		$inArr['name'] = $category->getName();
		$arr[] = $inArr;
	}

	echo json_encode(array('success' => true, 'items' => $arr));

} catch (Exception $e) {
	echo json_encode(array('success' => false,'error' => $e->getMessage()));
}